package com.atguigu.spzx.manager.controller;


import com.atguigu.spzx.manager.service.FileUploadService;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 上传文件接口
 *
 * @author Henry
 * @version 1.0
 * @program: spzx-parent
 * @create: 2025/6/10 下午12:06
 */

@RestController
@RequestMapping("/admin/system")
public class FileUploadController {

    @Resource
    private FileUploadService fileUploadService ;

    @PostMapping(value = "/fileUpload")
    public Result<String> fileUploadService(@RequestParam(value = "file")MultipartFile file){
        //1 获取上传的文件
        //2 调用service的方法上传，返回minio路径
        String fileUrl = fileUploadService.fileUpload(file) ;
        return Result.build(fileUrl , ResultCodeEnum.SUCCESS) ;
    }


}
